<script src="/javascripts/jquery.jeditable.js" type="text/javascript"></script>
<script src="/javascripts/in_line_edit_product.js" type="text/javascript"></script>
<%= javascript_include_tag 'admin_table.js' %>

<div id='breadcrumb'>
  <a href="/">首页</a>&gt;编辑价格
</div>
<br />
<div class="toolbar">
  <div class="title">
    选择商品
    <form action="" method="get">
      类别:<select name="category_id" id="category_id">
        <option value="0">
          不限...
        </option>
        <%=  options_for_select(categories_options,params[:category_id]) %>
      </select>

      品牌:
      <select name="brand_id" id="brand_id">
        <option value="0">
          不限...
        </option>
        <%= options_for_select(Brand.find(:all,:order => 'sort_order desc').collect {|b|[ b.name, b.id.to_s ]},params[:brand_id]) %>
      </select>

      <input type="submit" value="提交" ></input>
    </form>
  </div>
</div>
<% if @products %>
  <table class="admin">
    <thead>
      <tr>
        <th>名称</th>
        <th>入货价</th>
        <th>成本价</th>
        <th>零售价</th>
      </tr>
    </thead>
    <% for product in @products %>
      <tr>
        <td ><div class="edit_name"  id="<%=product.id%>"><%=h product.brand.name if product.brand %><%=h product.name %></div></td>
        <td style="height:50px;width:60px;"><div class="edit_purchase_price"  id="<%=product.id%>" style="width:80%;"><%=h product.purchase_price %></div></td>
        <td style="height:50px;width:60px;"><div class="edit_cost_price"  id="<%=product.id%>" style="width:80%;"><%=h product.cost_price %></div></td>
        <td style="height:50px;width:60px;"><div class="edit_retail_price"  id="<%=product.id%>" style="width:80%;"><%=h product.retail_price %></div></td>
      </tr>
    <% end %>
  </table>
<%end%>

<div style="display:none" id='hidden_form'>
  <%= form_tag('/categories')  %>
  <div id="cate_id"><%=params[:category_id]%></div>
</div>

